<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<base href="<%=request.getContextPath()%>/">
<link rel="stylesheet" href="about/css/bootstrap.min.css">
<link href="about/css/myCss.css" type="text/css" rel="stylesheet">
<link href="about/css/main.css" type="text/css" rel="stylesheet">
<link href="about/css/base.css" type="text/css" rel="stylesheet">
<!--按钮样式表-->
<link href="about/css/btn.css" type="text/css" rel="stylesheet">
<link href="about/css/css.css" type="text/css" rel="stylesheet">
<link href="about/css/index.css" type="text/css" rel="stylesheet">
<link href="about/css/search.css" type="text/css" rel="stylesheet">
<script src="about/js/jquery.min.js"></script>
<script src="about/js/bootstrap.min.js"></script>
<title>工作人员管理</title>
<script type="text/javascript">
	$(function() {
		var myModal1 = $(".myModal1");
		var xtyg = $("#xtyg");
		xtyg.click(function(evt) {
			myModal1.show();
		});
	})
</script>
<%
	pageContext.setAttribute("url", request.getRequestURI());
%>
<base href="${url}">
</head>
<body>
	<div class="hlnr page">
		
		<div class="col-md-12 pd20 RightContentBody fmt10">
		<form action="xtsz/gzrygl/list.do" method="post" id="form">
			<div class="col-md-3 pd0 fmt5">
				<div class="input-group inputWidth_search">
					<input type="text" class="form-control" placeholder="客户姓名" name="key">
					<span class="input-group-addon"><a
						href="javascript:document:form.submit();">查询</a></span>
				</div>
			</div>
			</form>
			<div class="col-md-9 pd0 fmt5">
				<button id="xtyg" class="btn btn-primary" data-toggle="modal"
					data-target=".myModal1">
					<span class="glyphicon glyphicon-plus"></span>&nbsp;添加
				</button>
			</div>
			<form action="xtsz/gzrygl/add.do" method="post">
			<div class="modal fade myModal1">
				<div class="modal-dialog">
					<div class="modal-content" style="width: 100%;">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
								aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
							<span class="glyphicon glyphicon-pencil"></span>&nbsp;【新增信息】
						</div>
						<div class="modal-body clearfix" style="height: auto;">
							<div class="col-md-12 pd0">
								<div class="col-md-1 pd0 mt10"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;账号：</span>
											<input class="form-control" name="account"/>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<p>
							<div class="col-md-12 pd0">
								<div class="col-md-1 pd0 mt10"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;姓名：</span>
											<input class="form-control" name="username"/>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;性别：</span>
											<select class="form-control" name="sex">
												<option value="1">男</option>
												<option value="0">女</option>
												
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;年龄：</span>
											<input type="text" class="form-control" name="age">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;员工类别：</span>
											<select class="form-control" name="roleId">
												<option value="2">医生</option>
												<option value="3">护士</option>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;人员状态：</span>
											<select class="form-control" name="status">
												<option value="0">离职</option>
												<option value="1">在职</option>
												
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;备注：</span>
											<input type="text" class="form-control" name="remarks">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
						</div>
						<div class="modal-footer mt20">
							<button type="submit" class="btn btn-primary"
								>确定</button>
							<button type="button" class="btn btn-default"
								data-dismiss="modal">取消</button>
						</div>
					</div>
				</div>
			</div>
			</form>
			<div class="col-md-12 pd0 fmt10">
				<hr class="commonHRCss" />
			</div>
			<div class="col-md-12 pd0">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>序号</th>
							<th>姓名</th>
							<th>性别</th>
							<th>年龄</th>
							<th>员工号</th>
							<th>员工类别</th>
							<th>入职时间</th>
							<th>操作人</th>
							<th>操作时间</th>
							<th>职务</th>
							<th>人员状态</th>
							<th>备注</th>
							<th></th>
							<th></th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<c:if test="${not empty um.rows}" scope="page" var="found">
							<c:forEach var="r" items="${um.rows}" varStatus="vs">
							<tr>
							<td>${vs.count}</td>
							<td>${r.username}</td>
							<c:if var="isM" test="${r.sex==1}" scope="page">
								<td>男</td>
							</c:if>
							<c:if test="${!isM}">
								<td>女</td>
							</c:if>
							<td>${r.age}</td>
							<td>${r.userCode}</td>
							<td>${r.role.name}</td>
							<td>
								<fmt:formatDate value="${r.createTime}" pattern="yyyy-MM-dd"/>
							</td>
							
							<td>${r.createBy.role.name}</td>
							<td>
								<fmt:formatDate value="${r.updateTime}" pattern="yyyy-MM-dd"/>
							</td>
							<td></td>
							
							
							<c:if test="${r.status==false}">
								<td>离职</td>
							</c:if>
							<c:if test="${r.status==true}">
								<td>在职</td>
							</c:if>
							<td>${r.remarks}</td>
							<td></td>
							<td></td>
							<td>
								<button class="btn btn-primary" data-toggle="modal" onclick="xxx(${r.id});"
									data-target=".myModal2" >修改</button>
								<a href="xtsz/gzrygl/remove.do?id=${r.id}">
								<button class="btn btn-danger" >删除</button>
								</a>
							</td>
						</tr>
							</c:forEach>
						</c:if>
					</tbody>
				</table>
			</div>
			<div class="col-md-12 pd0">
				<div class="col-md-12 text-right pd0 fmt20">
					<nav aria-label="Page navigation">
					<ul class="pagination">
	
							<li><a href="xtsz/gzrygl/list.do?pageno=${um.pageNo-1}" aria-label="Previous"> <span
								aria-hidden="true">&laquo;</span>
						</a></li>
						
						
						<c:forEach begin="1" end="${um.totalPages}" var="r">
							<li><a href="xtsz/gzrygl/list.do?pageno=${r}" >${r}</a></li>
						</c:forEach>
						<c:if test="${um.pageNo!=um.totalPages}">
							<li><a href="xtsz/gzrygl/list.do?pageno=${um.pageNo+1}" aria-label="Next"> <span
								aria-hidden="true">&raquo;</span>
						</a></li>
						</c:if>
					</ul>
					</nav>
				</div>
			</div>
			<form action="xtsz/gzrygl/modify.do" method="post">
			<div class="modal fade myModal2">
				<div class="modal-dialog">
					<div class="modal-content" style="width: 100%;">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
								aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
							<span class="glyphicon glyphicon-pencil"></span>&nbsp;【修改信息】
						</div>
						<div class="modal-body clearfix" style="height: auto;">
							<input name="id" value="" id="uid" hidden>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;性别：</span>
											<select class="form-control" name="sex" id="sexInfo">
												<option value="1">男</option>
												<option value="0">女</option>
											
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;年龄：</span>
											<input type="text" class="form-control" name="age" id="ageInfo">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								
								
							</div>
							
							
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;人员状态：</span>
											<select class="form-control" name="status" id="statusInfo">
												<option value="0">离职</option>
												<option value="1">在职</option>		
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;备注：</span>
											<input type="text" class="form-control" name="remarks" id="remarksInfo">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
						</div>
						<div class="modal-footer mt20">
							<button type="submit" class="btn btn-primary"
								>确定</button>
							<button type="button" class="btn btn-default"
								data-dismiss="modal">取消</button>
						</div>
					</div>
				</div>
			</div>
		</form>
		</div>
	</div>
	
	<script>
	var uid=$("#uid");
	var sexInfo=$("#sexInfo");
	var ageInfo=$("#ageInfo");
	var roleIdInfo=$("#roleIdInfo");
	var statusInfo=$("#statusInfo");
	var remarksInfo=$("#remarksInfo");
	function xxx(id) {
		uid.val(id);
		$.get("api/xtsz/gzrygl/userCheck",{id:uid.val()},function(resp){
			if(resp.code==="ok"){
				sexInfo.val(resp.data.sex);
				ageInfo.val(resp.data.age);
				roleIdInfo.val(resp.data.roleId);
				if(resp.data.status===true){
					statusInfo.val(1);
				}
				else{
					statusInfo.val(0);
				}
				remarksInfo.val(resp.data.remarks);
			}
		});
	}
	</script>
</body>
</html>
